package com.cqjtu.drive.controller;

/**
 * @Author zxl
 * @Date 2024/6/17 21:02
 */

import com.cqjtu.drive.pojo.Enroll;
import com.cqjtu.drive.response.Response;
import com.cqjtu.drive.service.EnrollService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class EnrollController {
    @Autowired
    EnrollService enrollService;

    @PostMapping("/api/enroll/insert")
    public Response<String> insertEnroll(@RequestBody Enroll enroll){
        return enrollService.insertEnroll(enroll);
    }
    @PostMapping("/api/enroll/getAllEnrollsWithAccept0")
    public Response<List<Enroll>> getAllEnrollsWithAccept0(){return enrollService.getAllEnrollsWithAccept0();}
    @PostMapping("/api/enroll/getAllEnrollsWaitRecord")
    public Response<List<Enroll>> getAllEnrollsWaitRecord(){return enrollService.getAllEnrollsWaitRecord();}
    @PostMapping("/api/enroll/updateAccept")
    public Response<String> updateEnrollAccept(@RequestParam String enId,@RequestParam String newAccept){
        return enrollService.updateEnrollAccept(enId,newAccept);
    }
    @PostMapping("/api/enroll/getAllEnrollsBySId")
    public Response<List<Enroll>> getAllEnrollsBySId(@RequestParam String sid){
        return enrollService.getAllEnrollsBySId(sid);
    }
    @PostMapping("/api/enroll/getNewestEnrollsBySId")
    public Response<Enroll> getNewestEnrollsBySId(@RequestParam String sid){
        return enrollService.getNewestEnrollsBySId(sid);
    }
    @PostMapping("/api/enroll/recordGrade")
    public Response<String> recordGrade(@RequestBody Map<String,String> map){
        return enrollService.recordGrade(map);
    }
}
